﻿#region Header

/*
Behavioral Rating of Dancing Human Crowds based on Motion Patterns
By

Pascal Hauser 
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

and

Raphael Gfeller
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

*/

#endregion

#region Usings

using System;
using System.Collections.ObjectModel;
using System.ComponentModel;

#endregion

namespace paravili.Services {
	/// <summary>
	/// is responsible for locating stored statistic data
	/// </summary>
	public interface IStatisticValuesLocatorService {
		#region Public Properties

		ObservableCollection<StatisticValueEntry> StatisticsValues { get; }

		#endregion

		#region Public Methods

		StatisticValueEntry this[string key] { get; }
		event EventHandler<StatisticValuesLocatorServiceEventArgs> StatisticValueEntryAdded;

		#endregion
	}

	#region datastructures

	/// <summary>
	/// datastructure for retrieving the statistic data entries
	/// </summary>
	public class StatisticValuesLocatorServiceEventArgs : EventArgs {
		#region Public Properties

		public StatisticValueEntry Entry { get; set; }

		#endregion
	}

	public class StatisticValueEntry : INotifyPropertyChanged {
		#region Public Properties

		public string Name { get; set; }

		public Object Value {
			get { return m_value; }
			set {
				m_value = value;
				if (PropertyChanged != null) {
					PropertyChanged(this, new PropertyChangedEventArgs("Value"));
				}
			}
		}

		#endregion

		#region Public Methods

		public override bool Equals(object obj) {
			if (obj is StatisticValueEntry) {
				return string.Equals((obj as StatisticValueEntry).Name, Name);
			}
			return base.Equals(obj);
		}

		public override int GetHashCode() {
			return Name.GetHashCode();
		}

		#endregion

		#region Private Fields

		private Object m_value;

		#endregion

		#region INotifyPropertyChanged Members

		public event PropertyChangedEventHandler PropertyChanged;

		#endregion
	}

	#endregion
}